<template>
  <el-card
    header="我是一个子组件"
  >
    <el-form
      ref="dataForm"
      label-position="left"
      label-width="120px"
      style="width: 400px; margin-left:50px;"
    >
      <el-form-item label="父组件传递给子组件的值">
        <el-input v-model="temp" />
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script>
export default {
  name: 'Child',
  props: ['valueFromParent'],
  computed: {
    temp: {
      get() {
        return this.valueFromParent
      },
      set(val) {
        this.$emit('update:valueFromParent', val)
      }
    }
  }
}
</script>

<style scoped>

</style>
